#include "Main.h"
#include "Config.h"
#include "Clock.h"
#include "Client.h"
#include "Server.h"
#include "Window.h"



int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow ){

	MSG msg;
	Config option;
	Clock Gametime = Clock();
	Server Srvr =Server(&option);
	Client Clnt = Client(hInstance,nCmdShow,&option);
	
	

	while(GetMessage(&msg,Window::s_hWnd,0,0))
	{
	TranslateMessage(&msg);
	DispatchMessage(&msg);

	if(Gametime.atInterval(SERVER_FPS)&&Srvr.Hosting){Srvr.RunFrame(Gametime.DeltaTicks);}
	Gametime.UpdateClock();
	if(Gametime.atInterval(CLIENT_FPS)){Clnt.RunFrame(Gametime.DeltaTicks);}

	Sleep(1);
	}	
	
return 0;
}



